/**
 * 封装评论模块
 */

import request from '@/utils/request.js'

/**
 * 获取文章评论
 */
export const getComment = params => {
  return request({
    methods: 'POST',
    url: '/v1_0/comments',
    params
  })
}
/**
 * 对评论或评论回复点赞
 */
export const addCommentLike = commentId => {
  return request({
    method: 'POST',
    url: '/v1_0/comment/likings',
    data: {
      target: commentId
    }
  })
}

/**
 * 取消对评论或评论回复点赞
 */
export const deleteCommentLike = commentId => {
  return request({
    method: 'DELETE',
    url: `/v1_0/comment/likings/${commentId}`
  })
}

/**
 * 对文章进行评论
 */
export const addComment = data => {
  return request({
    method: 'POST',
    url: '/v1_0/comments',
    data
  })
}
